﻿using MongoDB.Driver;
using System.Threading.Tasks;

namespace MongoDB
{
    /// <summary>
    /// MongoDB接口
    /// </summary>
    public interface IMongoDB
    {

        /// <summary>
        /// 获取MongDB数据库
        /// </summary>
        /// <param name="DatabaseName"></param>
        /// <returns></returns>
        IMongoDatabase GetMongoDatabase(string DatabaseName);

        /// <summary>
        /// 获取MongoDB集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="CollectionName"></param>
        /// <returns></returns>
        IMongoCollection<T> GetCollection<T>(string CollectionName);

        /// <summary>
        /// 获取MongoDB集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="DatabaseName">数据库名称</param>
        /// <param name="CollectionName">集合名称</param>
        /// <returns></returns>
        IMongoCollection<T> GetCollection<T>(string DatabaseName, string CollectionName);

        /// <summary>
        /// 删除集合
        /// </summary>
        /// <param name="CollectionName"></param>
        void DropCollection(string CollectionName);

        /// <summary>
        /// 删除集合
        /// </summary>
        /// <param name="DatabaseName"></param>
        /// <param name="CollectionName"></param>
        void DropCollection(string DatabaseName, string CollectionName);

        /// <summary>
        /// 删除集合(异步)
        /// </summary>
        /// <param name="CollectionName"></param>
        /// <returns></returns>
        Task DropCollectionAsync(string CollectionName);

        /// <summary>
        /// 删除集合(异步)
        /// </summary>
        /// <param name="DatabaseName"></param>
        /// <param name="CollectionName"></param>
        /// <returns></returns>
        Task DropCollectionAsync(string DatabaseName, string CollectionName);
    }
}
